const express = require('express')
const router = express.Router()
const { getCommentList, returnBack } = require('../../model/mongo')

router.get('/list', async (req, res) => {
    let result = {
        code: 200,
        msg: '获取全部评论列表'
    }
    result.data = await getCommentList()
    res.send(JSON.stringify(result))
})

router.post('/back', async (req, res) => {
    let { commentid, msg } = req.body
    let result = {
        code: 200,
        msg: '商家回复'
    }
    result.msg = await returnBack(commentid, msg)
    res.send(JSON.stringify(result))
})

module.exports = router
